package com.youmingxing.network;

import com.loopj.android.http.JsonHttpResponseHandler;
import com.loopj.android.http.RequestParams;

public class SelfInfoApi {

    public static void getSelfInfo(JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        HttpManager.client.post(HttpManager.BASE_URL + "user/info.json", params, handler);
    }

    //修改个人资料
    public static void modifyUserProfile(String optionName, String value, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        params.put(optionName, value);
        HttpManager.client.post(HttpManager.BASE_URL + "user/profile/modify.action", params, handler);
    }

    //修改多项个人资料
    public static void modifyMultiProfile(String[] optionNames, String[] values, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        for (int i = 0; i < optionNames.length; i++) {
            params.put(optionNames[i], values[i]);
        }
        HttpManager.client.post(HttpManager.BASE_URL + "user/profile/modify.action", params, handler);
    }

    //实名认证接口
    public static void realNameAuth(String name, String id_no, String id_img, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        params.put("name", name);
        params.put("id_no", id_no);
        params.put("id_img", id_img);
        HttpManager.client.post(HttpManager.BASE_URL + "user/real_auth.action", params, handler);
    }

    //实名认证详情
    public static void getRealAuthDetail(JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        HttpManager.client.post(HttpManager.BASE_URL + "user/real_auth_detail.json", params, handler);
    }

    //我的粉丝
    public static void getFans(int mark, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        if (mark != 0) {
            params.put("mark", mark);
        }
        HttpManager.client.post(HttpManager.BASE_URL + "user/fan.json", params, handler);
    }

    //某人的粉丝
    public static void getUserFans(int mark, int uid, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        if (mark != 0) {
            params.put("mark", mark);
        }
        params.put("uid", uid);
        HttpManager.client.post(HttpManager.BASE_URL + "user/user_fan.json", params, handler);
    }

    //我的关注
    public static void getMyFocus(int mark, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        if (mark != 0) {
            params.put("mark", mark);
        }
        HttpManager.client.post(HttpManager.BASE_URL + "user/follow.json", params, handler);
    }

    //某人的关注
    public static void getUserFocus(int mark, int uid, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        if (mark != 1) {
            params.put("mark", mark);
        }
        params.put("uid", uid);
        HttpManager.client.post(HttpManager.BASE_URL + "user/user_follow.json", params, handler);
    }

    //我的加油票
    public static void getMyTicket(int mark, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        if (mark != 1) {
            params.put("mark", mark);
        }
        HttpManager.client.post(HttpManager.BASE_URL + "ballot/list.json", params, handler);
    }

    //我的人气
    public static void getMyPopularity(int mark, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        if (mark != 1) {
            params.put("mark", mark);
        }
        HttpManager.client.post(HttpManager.BASE_URL + "popularity/show.json", params, handler);
    }

    //给我加油的投票者排行榜
    public static void getMyVoters(int mark, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        params.put("mark", mark);
        HttpManager.client.post(HttpManager.BASE_URL + "ballot/voter.json", params, handler);
    }

    //用户反馈
    public static void feedback(String content, String contactinfo, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        params.put("content", content);
        params.put("contactinfo", contactinfo);
        HttpManager.client.post(HttpManager.BASE_URL + "feedback.action", params, handler);
    }

    //获取分享标题文案、缩略图、链接
    public static void getShareContent(int type, int id, int entrance, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        //1.微信朋友圈; 2.微信好友; 3.QQ 4. 微博

        params.put("type", type);
        /*
            entrance为1时，传用户ID；
            entrance为2时，传 海选ID；
            entrance为3时，传 发布的动态ID
        */
        params.put("id", id);
        //1 个人主页 2 海选拉票页 3作品详情页
        params.put("entrance", entrance);
        HttpManager.client.post(HttpManager.BASE_URL + "share/config.json", params, handler);
    }

    //分享回调
    public static void shareSuccessCallback(int type, int id, int entrance, String timestamp, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        //1.微信朋友圈; 2.微信好友; 3.QQ 4. 微博

        params.put("type", type);
        /*
            entrance为1时，传用户ID；
            entrance为2时，传 海选ID；
            entrance为3时，传 发布的动态ID
        */
        params.put("id", id);
        //1 个人主页 2 海选拉票页 3作品详情页
        params.put("entrance", entrance);
        params.put("_r", timestamp);
        HttpManager.client.post(HttpManager.BASE_URL + "share/callback.action", params, handler);
    }

    //我的未读消息的数量
    public static void getMyNewsCount(JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        HttpManager.client.post(HttpManager.BASE_URL + "updates/related_notice_num.json", params, handler);
    }

    //获取与我相关的动态
    public static void getMyNews(JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        HttpManager.client.post(HttpManager.BASE_URL + "updates/related_notice.json", params, handler);
    }

    //删除我发布的作品
    public static void deleteMyWorks(int id, JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        params.put("id", id);
        HttpManager.client.post(HttpManager.BASE_URL + "updates/del.action", params, handler);
    }


    public static void getGuideInfo( JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        HttpManager.client.post(HttpManager.BASE_URL + "updates/guide.json", params, handler);
    }

    //是否能私信
    public static void isCansendMessage( JsonHttpResponseHandler handler) {
        RequestParams params = HttpManager.getBaseParams();
        HttpManager.client.post(HttpManager.BASE_URL + "chat/check_qualification.action", params, handler);
    }

}